package com.runas.sample;

import com.runas.core.txt.BigFileReader;
import com.runas.core.txt.IHandle;

import java.io.File;

public class App {

	static String txtPath = Thread.currentThread().getContextClassLoader().getResource("test.txt")
			.getPath();

	public static void main(String[] args) throws Exception {
		final File file = new File("/Users/zeroleavebaoyang/Desktop/output.txt");
		if (!file.exists()) {
			file.createNewFile();
		}
		BigFileReader bigFileReader = new BigFileReader.Builder(txtPath, new IHandle() {

			@Override
			public void handle(String line) {
				System.out.println(line);
//				writeContent(file, line);
			}
		}).withThreadSize(10).withCharset("UTF-8").withBufferSize(1024 * 1024).build();
		bigFileReader.start();
		bigFileReader.shutdown();
	}
}
